// import { userInfo } from '@/api/user'

const state = {
  userName: 'SangFall',
  access: '',
  rules: {}
}
const getters = {
  userNameFirstLetter: (state) => {
    return state.userName.substr(0, 1)
  }
}
const mutations = {
  SET_USER_NAME (state, params) {
    state.userName = params
  },
  SET_RULES (state, rules) {
    state.rules = rules
  }
}
const actions = {
  updateUserName ({ commit, state, rootState, dispatch }) {
    // rootState.appName
    // dispatch('xxx', '')
  },
  userInfo ({ commit }) {
    // return new Promise((resolve, reject) => {
    //   userInfo().then(res => {
    //     console.log(res)
    //     if (res.code === 200) {
    //       resolve(res.data.menuList)
    //     }
    //   }).catch(err => {
    //     reject(err)
    //   })
    // })
    commit('SET_RULES', { edit_button: true })
    return {
      home: true,
      about_page: true,
      about: true,
      about_echart: false,
      echart: false,
      table: true,
      tree: true,
      card: true,
      count_to: true,
      tinymce: true,
      excel: true
    }
  }
}
export default {
  // namespaced: true, // 命名空间
  state,
  getters,
  mutations,
  actions
}
